Release 10.1A: OpenEdge Development:
Java Open Clients
INPUT-OUTPUT and OUTPUT parameters
Java supports no direct mechanism to return a value from a method using parameters. An application can provide holder object parameters to contain the value you want to return.
Holder classes
For each Java data type that maps to a Progress data type, there is a
Holderclass. TheseHolderclasses belong to thecom.progress.open4glpackage and extend thecom.progress.open4gl.Holderclass, shown in Example 4–1.
This class has two constructors, one that does and one that does not set a value for the parameter. For an
OUTPUTparameter, you do not need to set a value in the holder object. For anINPUT-OUTPUTparameter, you typically do need to set a value to pass as input in the holder object. You can also set the value using thesetValue()method after the holder is created.For an
INPUT-OUTPUTparameter, you can set an input value to the 4GL Unknown value (?) by callingsetValue(null)on the holder object. ForINPUT-OUTPUTandOUTPUTparameters, the application can find out whether an unknown output value is returned by calling theisNull()method or testing for anullreturn value from thegetValue()method on the holder object.For each parameter data type extension, the holder class and method names changes as follows:
DataTypeNameis an initial upper-case name that closely matches the short intrinsic data type or class name for the value, andDataTypeis the exact primitave data type or full Java class name (with no changes in letter case).Table 4–3 shows the 4GL-to-Java mapping of
INPUT-OUTPUTandOUTPUTparameters to specific holder classes.
Table 4–3: Progress 4GL-to-Java data type mapping for INPUT-OUTPUT
and OUTPUT parameters Progress data type Java proxy data type DATASET DATASET-HANDLE1 TABLETABLE-HANDLE
- When mapped as a Java SDO DataGraph.1
TABLETABLE-HANDLE
- When mapped as an SQL ResultSet.1
Input holds:java.sql.ResultSetOutput holds:com.progress.open4gl.ProResultSet
1ProDataSet (DATASETandDATASET-HANDLE) and temp-table (TABLEandTABLE-HANDLE) parameters require special handling, including the mapping of temp-table fields. For more information on ProDataSet and temp-table parameters, see the "Passing temp-tables and ProDataSets" section.
Table 4–4 shows the 4GL array-to-Java mapping of
INPUT-OUTPUTandOUTPUTarray parameters to specific holder classes.
Table 4–4: Progress 4GL with array-to-Java data-type mapping for INPUT-OUTPUT and OUTPUT array parameters Progress 4GL array option Java proxy data type
Holder class definitions
The holder class definitions for each data type follow the form shown in Example 4–2.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |